$(document).ready(function show() {
	$('#footer').html('平凡的世界(CommonWorld.COM.CN)');
	
	if (visitorStatus.login) {
		$('.control_select').hover(function() {
			$('.control_select .cw_content').show("fast");
		}, function() {
			$('.control_select .cw_content').hide("fast");
		});
	}
	
});


function setLogoutGoToPage() {
	try {
		var logout = $('#CW_UserBar .control_select').next("a");
		if (logout) {
			logout.attr("href", webContextPath + "/user/logout" + "?goto_page=" + window.location.href);
		} else {
			alert(window.location.href);
		}
	} catch(e) {
		alert(window.location.href);
	}
}

function updateUserBar() {
	if (userStatus.login) {
		var userBar = $('#CW_UserBar');
		$('.control_select').hover(function() {
			$('.control_select .cw_content').show("fast");
		}, function() {
			$('.control_select .cw_content').hide("fast");
		});
		
		userBar.children('em').first().text(userInfo.name);
		var select = userBar.children('.control_select').first();
		select.children('a[title = "我的空间"]').attr("href", webRoot + webContextPath + "/u/" + userInfo.id);
		var content = select.children('ul.cw_content li a');
		setLogoutGoToPage();
	}
}